<template>
    <!--用户行为日期展示框-->
    <div id="userDialog">
				<span style="color: red;line-height: 14px">*</span> &nbsp;群显示名
			<div style="margin-bottom: 15px">	<a-input class="group-name-input" v-model="name" style="width: 300px;"></a-input></div>
				群备注

			<div>
				<a-textarea
					style="width: 300px"
					class="group-name-input"
					placeholder="输入50字以内的分组描述"
					:autoSize="{ minRows: '3', maxRows: '5' }"
					:maxLength="50"
				>
				</a-textarea>
			</div>

			<div style="margin-bottom: 15px;margin-top: 15px">
				<a-row>
					<a-col :span="24">
						<a-button type="primary" class="sure" @click="submit">确定</a-button>
						<a-button class="sure" @click="cancal" style="margin-right: 10px"  >取消</a-button>
					</a-col>
				</a-row>
			</div>

    </div>
</template>

<script>
	/**
	 * api 接口
	 * */
	import {saveResultCrowd} from '../../../../api/userAttr'
    export default {
        name: "userDialog",
        props: {
					//点击表格中人数触发的弹框
					userDialogData: {
						type: Object
					},
        },
        data() {
            return {
							name: ""
            }
        },
        methods: {
            //查看用户列表
            // userList() {
            //     let routeData = this.$router.resolve({ path: '/dataAnalysis/pathAnalysis', query: {  "":JSON.stringify(this.userDialogData)} })
            //     window.open(routeData.href, '_blank')
            // },
					submit(){
						// eslint-disable-next-line @typescript-eslint/no-this-alias
						let t = this
						this.userDialogData['crowdName'] = this.name
						if (!this.isNullStr(this.name)){
							this.$message.warn("报表名称最低2个字符,最多24个字符,不可以为空,不可以带空格")
							return
						}
						saveResultCrowd(this.userDialogData).then((res) =>{
							if (res.code === 200) {
								t.$message.success("保存成功")
							}else{
								t.$message.error("保存失败")
							}
						}).catch((err) => {
							this.$message.error(err.msg || err.message, 5)
						}).finally((res)=>{
							t.$parent.$parent.$parent.$parent.$parent.$parent.$parent.$el.click()
							t.$forceUpdate()
						})
					},
					cancal(){
						this.$parent.$parent.$parent.$parent.$parent.$parent.$parent.$el.click()
					},
					isNullStr(str){
						if (str.indexOf(" ") > -1 || str.length > 24 || str.length < 2) {
							return false
						}else{
							return true
						}
					}
        },
        watch: {

        }
    }
</script>

<style lang="scss" scoped>

    *, *::before, *::after {
        box-sizing: border-box;
    }

    #userDialog {

        padding: 5px 0;
        margin-top: -3px;
        z-index: 1070;
        font-size: 12px;
        font-weight: 400;
        line-height: 1.4;
				.group-name-input{
					margin-top: 10px;
					margin-bottom: 10px;
				}

    }
	.sure{
		float: right;
	}
</style>
